import { computed } from 'vue'

export function useBtns(props) {
  const list = computed(() => {
    return props.btns
      .map((item) => {
        let hide = !!item.hide
        if (item.hide && typeof item.hide === 'function') {
          hide = item.hide()
        }
        return {
          ...item,
          hide
        }
      })
      .filter((item) => !item.hide)
  })

  return { list }
}
